#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>

using namespace std;

#define ABI 15
#define ABJ 150

const char ABAK_DEF[10][14] = 	{	
						{"** -    *****"}, //0
						{"** -*    ****"}, //1
						{"** -**    ***"}, //2
						{"** -***    **"}, //3
						{"** -****    *"}, //4
						{"* *-    *****"}, //5
						{"* *-*    ****"}, //6
						{"* *-**    ***"}, //7
						{"* *-***    **"}, //8
						{"* *-****    *"}, //9
							};

void removeZeros(char * in) {
	char * it = in;
	if(strlen(in) == 1)
		return;
	while(*it == '0') {
		it++;
	}
	strcpy(in, it);
}

void print_abakus(char abakus[ABI][ABJ], int nl) {
	int i;
	for(i = 0; i < 15; i++) {
		printf("%s\n", abakus[i]);
	}
//	printf("\n");
}

int  main() {
	char check[10], number[1000], abakus[ABI][ABJ], ch;
	int i, j, nl, k = 0;
	
	/*
	while(cin >> check) {
		cin >> number;
		cout << check << "\t" << number << endl;
	}
	*/

	/*
	while(scanf("%[^\n]", check) != EOF) {
		scanf("%s", number);
		//printf("%s %s\n", check, number);
	}
	*/
	
	//while(scanf("%[^\n] ", check) != EOF)  {
	//while ((ch = getchar()) != EOF) {
	//while(scanf("%s", check) == 1) {
	while(scanf("%[^\n]*c", check) != EOF) {
		//scanf("%c\n", &ch);
	//while(cin >> check) {
		//fflush(stdin);
		//printf("%s\n", check);
		
		if(check[0] == '0') {
			for(i = 0; i < 15; i++) {
				scanf("%[^\n]", abakus[i]);
				scanf("%c\n", &ch);
			}

			nl = strlen(abakus[0]);
			for(i = 1; i < nl - 1; i++) {
				if(abakus[2][i] == ' ')
					k = 5;
				else 
					k = 0;
				j = 5;
				while(abakus[j][i] == '*') {
					j++;
				}
				number[i - 1] = k + '0' + j - 5;
			}
			number[nl - 2] = 0;
			printf("1\n%s\n", number);
		} else {
			scanf("%c\n", &ch);
			scanf("%s", number);
			
			removeZeros(number);
			//printf("%s", number);
			nl = strlen(number);
			//printf("(%d)%s\n", nl, number);
			
			//drawing frame
			//horizontal
			for(i = 0; i < nl + 2; i++) {
				abakus[0][i] = '-';
				abakus[14][i] = '-';
			}
			
			abakus[0][i] = 0;
			abakus[14][i] = 0;
			
			for(i = 1; i < 14; i++) {
				abakus[i][0] = '|';
				abakus[i][nl+1] = '|';
				abakus[i][nl+2] = 0;
			}
			//spacing
			
			for(i = 1; i < 14; i++) {
				for(j = 1; j < nl+1; j++)
					abakus[i][j] = ' ';
			}
			
			
			for(i = nl; i > 0; i--) {
				for(j = 1; j < 14; j++) {
					abakus[j][i] = ABAK_DEF[number[i-1]-'0'][j-1];
				}
			}
			printf("0\n");			
			print_abakus(abakus, nl);
		
		}

	}
	return 0;
}
